<?php

$api = app('Dingo\Api\Routing\Router');
$moduleName = 'Box';

// 平台后台api
$api->version('v1', ['prefix' => 'admin-api', 'namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Admin\V1'], function ($api) {

	$allMethod = ['index', 'show', 'store', 'update', 'destroy'] ;

	$api->resource('boxes', "BoxController", ['only' => $allMethod]);
	// $api->resource('IPs', "IPController", ['only' => $allMethod]);

	// $api->resource('products', "ProductController", ['only' => $allMethod]);

	// 普通款
	$api->resource('/boxes/{uuid}/normal-skus', "NormalSkuController", ['only' => $allMethod]);

	// 隐藏款
	$api->resource('/boxes/{uuid}/hidden-skus', "HiddenSkuController", ['only' => $allMethod]);

	// 兑换碎片
	$api->resource('/boxes/{uuid}/skus', "SkuController", ['only' => $allMethod]);

	// 预售日历中的项
	$api->resource('/presell-items', "PresellItemController", ['only' => $allMethod]);

	$api->get('/status-total/box', ['uses'=> "BoxController@statusTotal"]);

	// 复制活动
	$api->post('/boxes/{uuid}/copy', ['uses'=> "BoxController@copy"]);


	$api->resource('/box-rank', "BoxRankController", ['only' => $allMethod]);

	// $api->get('/swiper', ['uses'=> "UIController@getSwiper"]);
	// $api->put('/swiper', ['uses'=> "UIController@setSwiper"]);

	// $api->get('/pages/{page}', ['uses'=> "UIController@getPage"]);
	// $api->put('/pages/{page}', ['uses'=> "UIController@setPage"]);
});

// 租户api
// $api->version('v1', ['prefix' => 'tenant-api', 'namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Tenant\V1'], function ($api) {
// 	$allMethod = ['index', 'show', 'store', 'update', 'destroy'];
// });

// 普通用户api
$api->version('v1', ['namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Client\V1'], function ($api) {

	$allMethod = ['index', 'show', 'store', 'update', 'destroy'];

	$api->resource('boxes', "BoxController", ['only' => $allMethod]);

	$api->get('/boxes/{uuid}/next-room', ['uses'=> "BoxController@nextRoom"]);

	// 开盒记录
	$api->get('/boxes/{uuid}/records', ['uses'=> "RecordController@index"]);

	// 隐藏款销售榜单
	$api->get('/boxes/{uuid}/hidden-sku-rank', ['uses'=> "BoxController@hiddenSkuRank"]);

	$api->post('/box-order/preview', ['uses'=> "BoxOrderController@preview"]);
	$api->post('/box-order/confirm', ['uses'=> "BoxOrderController@confirm"]);


	// 使用提示卡或透视卡
	$api->post('/box/use-card', ['uses'=> "BoxCardController@use"]);

	// 换小盒
	$api->post('/box/change-sku', ['uses'=> "RoomSkuController@changeSku"]);

	// 某个房间某个小盒的信息
	$api->get('/rooms/{uuid}/skus/{index}', ['uses'=> "RoomSkuController@show"]);


	// 搜索
	// $api->post('/search', ['uses'=> "SearchController@store"]);


	// 某个盲盒的sku
	$api->get('/boxes/{uuid}/skus', ['uses'=> "BoxSkuController@index"]);


	// 预售日历
	$api->get('/presell-items', ['uses'=> "PresellItemController@index"]);

	// 淘宝小程序获取剩余可用次数
	// $api->post('/ali/check-remain-time', ['uses'=> "RemainTimeController@check"]);
});
